<table class="table table-th-block table-hover">                                
     <thead>
          <tr>
              <th class="text_content" style="width:50px;">编号</th>
              <th class="text_content" style="width: 100px;">请假类型</th>
              <th class="text_content" style="width:80px;">请假人</th>
              <th class="text_content">请假理由</th>
              <th class="text_content" style="width: 100px;">开始时间</th>
              <th class="text_content" style="width: 100px;">结束时间</th>
              <th class="text_content" style="width:100px">请假时间</th> 
              <th class="text_content" style="width: 100px;">审批状态</th>
          </tr>
     </thead>                                
     <tbody>
          <foreach name="page" key="key" item="value">     
                <tr>
                     <td class="text_content sub color_hover detail" id="{$leave[$value['leave_id']]['leave_id']}">{$leave[$value['leave_id']]['leave_id']}</td> 
                      <td class="text_content">{$leave[$value['leave_id']]['type_name']}</td>
                      <td class="text_content">{$leave[$value['leave_id']]['audience_name']}</td>
                     <td style="word-break:break-all">{$leave[$value['leave_id']]['leave_reason']}</td>
                      <td class="text_content">{$leave[$value['leave_id']]['leave_startTime']|date="Y-m-d H:i:s",###}</td>
                     <td class="text_content">{$leave[$value['leave_id']]['leave_endTime']|date="Y-m-d H:i:s",###}</td>
                     <td class="text_content">{$leave[$value['leave_id']]['leave_days']}</td>
                     <td class="text_content state" name="{$leave[$value['leave_id']]['leave_state']}">{$leave[$value['leave_id']]['leave_state']}</td>                                           
                 </tr>
           </foreach>
    </tbody>
</table>
<ul class="pagination success">{$show}</ul>
<script type="text/javascript">
$(".current").css({background:"#8CC152",color:"white"});
//首页
    $(".first").click(function(){
         var page = $(this).attr("name");
         var name = $("#search_name").val();
         var time = $("#search_time").val();
        $.ajax({
            url:"__URL__/search",
            data:{"page":page,"search":name,"time":time},
            type:"post",
            success:function(data){                                                 
                $(".div_search").html(data);
            }
        });
    });

//上一页
    $(".prev").click(function(){      
        var name = $("#search_name").val();        
        var current = $(".current").attr("title");
        var time = $("#search_time").val();
        var current = parseInt($(".current").attr("title"));
        current -=1;
        //alert(current);
        $.ajax({
            url:"__URL__/search",
            data:{"page":current,"search":name,"time":time},
            type:"post",
            success:function(data){
                $(".div_search").html(data);
            }
        });
    });
//第几页
    $(".number").click(function(){
        var name = $("#search_name").val();        
        var num = $(this).attr("title");
        var time = $("#search_time").val();
        $.ajax({
            url:"__URL__/search",
            data:{"page":num,"search":name,"time":time},
            type:"post",
            success:function(data){
                $(".div_search").html(data);
            }
        });
    });
//下一页
    $(".next").click(function(){
        var name = $("#search_name").val();        
        var current = $(".current").attr("title");
        var time = $("#search_time").val();
        var current = parseInt($(".current").attr("title"));
        current +=1;
       // alert(current);                                    
        $.ajax({
            url:"__URL__/search",
            data:{"page":current,"search":name,"time":time},
            type:"post",
            success:function(data){
                $(".div_search").html(data);
            }
        });
    });
//尾页
    $(".last").click(function(){
        var page = $(this).attr("name");
        var name = $("#search_name").val();
        var time = $("#search_time").val();                                            
        $.ajax({
            url:"__URL__/search",
            data:{"page":page,"search":name,"time":time},
            type:"post",
            success:function(data){                                         
                $(".div_search").html(data);
            }
        });
    });

//请假详情
 $(".detail").click(function(){
    var leave_id = $(this).attr("id");
    $.ajax({
        url:"__URL__/detail",
        data:{"leave_id":leave_id},
        type:"post",
        success:function(data){
            $('.leave-log').html(data);
        }
    });
 });

for(var i=0;i<$(".state").length;i++){    
    var state = $(".state:eq("+i+")").attr("name");      
    switch(state){
        case "0":
            $(".state:eq("+i+")").text("审批中");
        break;
        case "1":
            $(".state:eq("+i+")").text("已审批");
        break;
        case "2":
            $(".state:eq("+i+")").text("已驳回");
        break;
        case "3":
            $(".state:eq("+i+")").text("申请销假");
        break;
        case "4":
            $(".state:eq("+i+")").text("同意销假");
        break;
        case "5":
            $(".state:eq("+i+")").text("驳回销假");
        break;
        }
    }   
</script>